<template>
	<view class="content">
		<test :msg="msg" @testEvent="testEvt"></test>
		<!-- <view>
		<swiper indicator-dots="true" autoplay="true" interval="2000">
			<swiper-item>
				<image src="../../static/imgs/1.jpg"></image>
			</swiper-item>
			<swiper-item>
				<image src="../../static/imgs/小黄人.jpg"></image>
			</swiper-item>
			<swiper-item>
				<image src="../../static/imgs/dog.jpg"></image>
			</swiper-item>
		</swiper>
		</view> -->
	</view>
</template>

<script>
	import test from "../../components/test.vue"
	export default {
		data() {
			return {
				msg:"msg"
			}
		},
		components:{
			test
		},
		onLoad() {
			// 使用uni提供的$on $once 等方法实现组件传值
			// $on可以无限次的触发事件
			uni.$on("testEmit",function(val){
			//或者
			// uni.$on("testEmit",(val)=>{
				console.log(val)
			})
			// $once只能触发一次
			// uni.$once("testEmit",(val)=>{
			// 	console.log(val)
			// })
		},
		methods: {
			testEvt(val){
				console.log(val)
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
